<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template2.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditResponsavelTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">

            <!--<h:form prependId="false">-->
            <p:growl id="messages" life="3000"/>

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
            </h:panelGroup>

            <p:panel>
                <f:facet name="header">
                    <h:outputText value="#{bundle.LegendResponsavelTitle}"></h:outputText>
                </f:facet>

                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditResponsavelLabel_rspId}" for="rspId" />
                    <p:inplace>                            
                        <p:inputText id="rspId" value="#{responsavelController.selected.rspId}" title="#{bundle.EditResponsavelTitle_rspId}" />
                    </p:inplace>
                    <h:outputLabel value="#{bundle.EditResponsavelLabel_rspNm}" for="rspNm" />
                    <p:inputText id="rspNm" size="70" maxlength="100" value="#{responsavelController.selected.rspNm}" title="#{bundle.EditResponsavelTitle_rspNm}" required="true" requiredMessage="#{bundle.EditResponsavelRequiredMessage_rspNm}" >
                        <p:focus for="rspNm"/>
                    </p:inputText>                    
                    <h:outputLabel value="#{bundle.EditResponsavelLabel_rspEmail}" for="rspEmail" />
                    <p:inputText id="rspEmail" size="70" maxlength="255" value="#{responsavelController.selected.rspEmail}" title="#{bundle.EditResponsavelTitle_rspEmail}" >
                        <f:validator for="rspEmail" validatorId="br.gov.ana.validators.EmailValidator"/>
                    </p:inputText>
                    <h:outputLabel value="#{bundle.EditResponsavelLabel_rspCrgId}" for="rspCrgId" />
                    <p:selectOneMenu id="rspCrgId" value="#{responsavelController.selected.rspCrgId}"  >
                        <f:selectItems value="#{cargoController.itemsAvailableSelectOne}"/>
                    </p:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditResponsavelLabel_rspAreId}" for="rspAreId" />
                    <p:selectOneMenu id="rspAreId" value="#{responsavelController.selected.rspAreId}"  >
                        <f:selectItems value="#{areaController.itemsAvailableSelectOne}"/>
                    </p:selectOneMenu>


                    <h:outputLabel value="#{bundle.createBy}" for="nomeCriador" rendered="#{not empty responsavelController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputText id="nomeCriador" value="#{responsavelController.selected.historicoCriacao.nomeUsuario}" rendered="#{not empty responsavelController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.createDate}" for="dataCriacao" rendered="#{not empty responsavelController.selected.historicoCriacao.dataHora}"/>
                    <h:outputText id="dataCriacao" value="#{responsavelController.selected.historicoCriacao.dataHora}" rendered="#{not empty responsavelController.selected.historicoCriacao.dataHora}"/>     
                    <h:outputLabel value="#{bundle.updateBy}" for="nomeAlterador" rendered="#{not empty responsavelController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputText id="nomeAlterador" value="#{responsavelController.selected.historicoAlteracao.nomeUsuario}" rendered="#{not empty responsavelController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.updateDate}" for="dataAlteracao" rendered="#{not empty responsavelController.selected.historicoAlteracao.dataHora}"/>
                    <h:outputText id="dataAlteracao" value="#{responsavelController.selected.historicoAlteracao.dataHora}" rendered="#{not empty responsavelController.selected.historicoAlteracao.dataHora}" /> 

                </h:panelGrid>
                <br />

                <p:commandButton ajax="false" rendered="#{!autenticadorController.loginVisualizador}" icon="#{bundle.icone_salvar}" action="#{responsavelController.update}" value="#{bundle.EditResponsavelSaveLink}"/> &nbsp;                
                <p:commandButton ajax="false" action="#{responsavelController.prepareList}" icon="#{bundle.icone_listar}" value="#{bundle.EditResponsavelShowAllLink}" immediate="true"/>

            </p:panel>
            <!--</h:form>-->
        </ui:define>
    </ui:composition>

</html>
